<template>
  <div>
    <Header></Header>
    <!--<HeadNav></HeadNav>-->
    <HeaderBanner :list="swiperList"></HeaderBanner>
    <HomeIcons></HomeIcons>
    <HomeRecommend :list="recommendList"></HomeRecommend>
  </div>
</template>

<script>
import Header from './components/Header'
import HeadNav from './components/HeadNav'
import HeaderBanner from './components/HeaderBanner'
import HomeIcons from './components/HomeIcons'
import HomeRecommend from './components/HomeRecommend'
import axios from 'axios'
export default {
  name: 'Home',
  components: {
    Header,
    HeadNav,
    HeaderBanner,
    HomeIcons,
    HomeRecommend
  },
  data () {
    return {
      swiperList: [],
      recommendList: []
    }
  },
  methods: {
    getHomeInfo () {
      axios.get('/api/index.json')
        .then(this.getHomeInfoSucc)
    },
    getHomeInfoSucc (res) {
      // console.log(res)res是所以获得的json数据
      res = res.data
      if (res.ret && res.data) {
        const data = res.data
        this.swiperList = data.swiperList
        this.recommendList = data.recommendList
      }
    }
  },
  mounted () {
    this.getHomeInfo()
  }
}
</script>
<style lang="stylus" scoped>
</style>
